var express = require('express');
var router = express.Router();
var users = require('./module/user');
var pages = require('./module/page');
var data=require('./module/page/data');
var tokenM = require('./module/user/token_manage');
var expressjwt = require('express-jwt');

/*页面部分*/
/* 首页 */
router.use(expressjwt({
  secret: tokenM.conf.secret,
  credentialsRequired: false
}),tokenM.verify)
router.get('/', pages.index);
router.get('/',data.index);
/* 登陆页 */
router.get('/login', pages.login);
/* 注册页 */
router.get('/register', pages.register);
/* 开店页*/
router.get('/openShop', pages.openShop);
router.get('/openShop',data.openShop);
router.get('/myShop', pages.myShop);
router.get('/myShop',data.myShop);
router.get('/shopList', pages.shopList);
router.get('/shopList',data.shopList);
router.get('/shop/:id', pages.shop);
router.get('/shop/:id',data.shop);
router.get('/order', pages.order);
router.get('/order',data.order);
router.get('/userCenter', pages.userCenter);
router.get('/userCenter',data.userCenter);
/* 获取页面模板*/
router.get('/tpl/:page/',pages.tpl);







/*操作部分*/
/*注册*/
router.post('/register',users.register);
/*登陆*/
router.post('/login',users.login);
/*登出*/
router.post('/logout',users.logout);



module.exports = router;
